﻿using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Model.Tokens;

namespace ViewModel.WindowViewModel;

public partial class MainViewModel : ObservableObject
{
    public MainViewModel()
    {
        WeakReferenceMessenger.Default.Register<UserControl>(this, ReferenceView);
    }

    private void ReferenceView(object recipient, UserControl message)
    {
        ContentControl = message;
    }

    #region UserControl

    [ObservableProperty] private UserControl? _contentControl;

    #endregion

    [RelayCommand]
    private void ShowLoginControl()
    {
        WeakReferenceMessenger.Default.Send(new MainContentTokenModel() { Token = "Login" });
    }
}